﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;

/// <summary>
/// Summary description for AutoComplete
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[System.Web.Script.Services.ScriptService]
public class AutoComplete : System.Web.Services.WebService
{

    public AutoComplete()
    {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    public string[] SelectDanhSachNSX(string prefixText)
    {
        DataSet objNSXDS;
        NhaSanXuatBUS objNSX = new NhaSanXuatBUS(TGDDConfiguration.DbConnectionString);
        objNSXDS = objNSX.SelectNhaSanXuat_AutoComplete(prefixText);
        DataRowCollection nsxList = objNSXDS.Tables["SelectNhaSanXuat_AutoComplete"].Rows;

        List<string> items = new List<string>(nsxList.Count);
        for (int i = 0; i < nsxList.Count; i++)
        {
            DataRow row = nsxList[i];
            items.Add(row["TenNSX"].ToString());
        }
        return items.ToArray();
    }

}

